<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>LuaApp项目接口文档</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>LuaApp</h1>

<ul>
  <li><a href="../index.html">Index</a></li>
</ul>

<h2>Contents</h2>
<ul>
<li><a href="#Methods">Methods</a></li>
</ul>


<h2>Classes</h2>
<ul class="nowrap">
  <li><a href="../classes/ActivityIndicatorView.html">ActivityIndicatorView</a></li>
  <li><a href="../classes/AlertView.html">AlertView</a></li>
  <li><a href="../classes/Application.html">Application</a></li>
  <li><a href="../classes/AudioEngine.html">AudioEngine</a></li>
  <li><a href="../classes/Button.html">Button</a></li>
  <li><a href="../classes/CaptureView.html">CaptureView</a></li>
  <li><a href="../classes/CheckBox.html">CheckBox</a></li>
  <li><a href="../classes/ClippingView.html">ClippingView</a></li>
  <li><a href="../classes/Control.html">Control</a></li>
  <li><a href="../classes/DatePickerView.html">DatePickerView</a></li>
  <li><a href="../classes/Device.html">Device</a></li>
  <li><strong>DownloadManager</strong></li>
  <li><a href="../classes/DrawView.html">DrawView</a></li>
  <li><a href="../classes/DrawerController.html">DrawerController</a></li>
  <li><a href="../classes/FileUtils.html">FileUtils</a></li>
  <li><a href="../classes/GifView.html">GifView</a></li>
  <li><a href="../classes/HttpClient.html">HttpClient</a></li>
  <li><a href="../classes/HttpRequest.html">HttpRequest</a></li>
  <li><a href="../classes/Image.html">Image</a></li>
  <li><a href="../classes/ImageView.html">ImageView</a></li>
  <li><a href="../classes/Label.html">Label</a></li>
  <li><a href="../classes/LinearView.html">LinearView</a></li>
  <li><a href="../classes/ListView.html">ListView</a></li>
  <li><a href="../classes/ListViewCell.html">ListViewCell</a></li>
  <li><a href="../classes/NavController.html">NavController</a></li>
  <li><a href="../classes/Progress.html">Progress</a></li>
  <li><a href="../classes/Slider.html">Slider</a></li>
  <li><a href="../classes/Stepper.html">Stepper</a></li>
  <li><a href="../classes/Switch.html">Switch</a></li>
  <li><a href="../classes/TabBarController.html">TabBarController</a></li>
  <li><a href="../classes/TextField.html">TextField</a></li>
  <li><a href="../classes/TextView.html">TextView</a></li>
  <li><a href="../classes/UILoader.html">UILoader</a></li>
  <li><a href="../classes/View.html">View</a></li>
  <li><a href="../classes/ViewController.html">ViewController</a></li>
  <li><a href="../classes/WebView.html">WebView</a></li>
  <li><a href="../classes/Window.html">Window</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
  <li><a href="../modules/Animation.html">Animation</a></li>
  <li><a href="../modules/class.html">class</a></li>
  <li><a href="../modules/constants.html">constants</a></li>
  <li><a href="../modules/crossapp.html">crossapp</a></li>
  <li><a href="../modules/cjson.html">cjson</a></li>
  <li><a href="../modules/mobdebug.html">mobdebug</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
  <li><a href="../topics/readme.md.html">readme</a></li>
  <li><a href="../topics/layout.md.html">layout</a></li>
</ul>

</div>

<div id="content">

<h1>Class <code>DownloadManager</code></h1>
<p>下载管理器， 通过 ca.sharedDownloadManager() 获取当前实例</p>
<p>

</p>


<h2><a href="#Methods">Methods</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:enqueueDownload">DownloadManager:enqueueDownload (fileUrl, fileName, headers, textTag)</a></td>
	<td class="summary">添加下载任务</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:enqueueDownloadEx">DownloadManager:enqueueDownloadEx (fileUrl, fileName, headers, textTag)</a></td>
	<td class="summary">添加下载任务，如果有该url的文件正在下载则移除之前的任务</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:resumeDownload">DownloadManager:resumeDownload (downloadId)</a></td>
	<td class="summary">恢复下载</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:pauseDownload">DownloadManager:pauseDownload (downloadId)</a></td>
	<td class="summary">暂停下载</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:eraseDownload">DownloadManager:eraseDownload (downloadId)</a></td>
	<td class="summary">移除下载</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:getDownloadUrl">DownloadManager:getDownloadUrl (downloadId)</a></td>
	<td class="summary">获取下载的url</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:getDownloadHeader">DownloadManager:getDownloadHeader (downloadId)</a></td>
	<td class="summary">获取下载的头信息</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:getFilePath">DownloadManager:getFilePath (downloadId)</a></td>
	<td class="summary">获取下载的文件路径</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:getTotalFileSize">DownloadManager:getTotalFileSize (downloadId)</a></td>
	<td class="summary">获取下载的文件总大小</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:getLocalFileSize">DownloadManager:getLocalFileSize (downloadId)</a></td>
	<td class="summary">获取已下载的文件大小</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:getStartTime">DownloadManager:getStartTime (downloadId)</a></td>
	<td class="summary">获取已下载的文件开始时间</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:isFinished">DownloadManager:isFinished (downloadId)</a></td>
	<td class="summary">获取是否已下载完成</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:isDownloading">DownloadManager:isDownloading (downloadId)</a></td>
	<td class="summary">获取是否正在下载</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:clearOnSuccessDownloadAllRecord">DownloadManager:clearOnSuccessDownloadAllRecord ()</a></td>
	<td class="summary">清空完成记录</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:clearOnSuccessDownloadRecord">DownloadManager:clearOnSuccessDownloadRecord (downloadId)</a></td>
	<td class="summary">清空单个完成记录</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:getDownloadIdsFromTextTag">DownloadManager:getDownloadIdsFromTextTag (tag)</a></td>
	<td class="summary">根据标签获取下载id</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:getDownloadAllTextTags">DownloadManager:getDownloadAllTextTags ()</a></td>
	<td class="summary">获取下载的文件标签</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:getDownloadMaxCount">DownloadManager:getDownloadMaxCount ()</a></td>
	<td class="summary">获取同时下载的文件最大数</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:setDownloadMaxCount">DownloadManager:setDownloadMaxCount (count)</a></td>
	<td class="summary">设置同时下载的文件最大数</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DownloadManager:setDownloadManagerDelegate">DownloadManager:setDownloadManagerDelegate (callbacks)</a></td>
	<td class="summary">设置下载进度处理</td>
	</tr>
</table>

<br/>
<br/>


    <h2 class="section-header "><a name="Methods"></a>Methods</h2>

    <dl class="function">
    <dt>
    <a name = "DownloadManager:enqueueDownload"></a>
    <strong>DownloadManager:enqueueDownload (fileUrl, fileName, headers, textTag)</strong>
    </dt>
    <dd>
    添加下载任务


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">fileUrl</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>



        </li>
        <li><span class="parameter">fileName</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>



        </li>
        <li><span class="parameter">headers</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>



        </li>
        <li><span class="parameter">textTag</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">int</span></span>
        downloadId
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:enqueueDownloadEx"></a>
    <strong>DownloadManager:enqueueDownloadEx (fileUrl, fileName, headers, textTag)</strong>
    </dt>
    <dd>
    添加下载任务，如果有该url的文件正在下载则移除之前的任务


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">fileUrl</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>



        </li>
        <li><span class="parameter">fileName</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>



        </li>
        <li><span class="parameter">headers</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>



        </li>
        <li><span class="parameter">textTag</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">int</span></span>
        downloadId
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:resumeDownload"></a>
    <strong>DownloadManager:resumeDownload (downloadId)</strong>
    </dt>
    <dd>
    恢复下载


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">downloadId</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "DownloadManager:pauseDownload"></a>
    <strong>DownloadManager:pauseDownload (downloadId)</strong>
    </dt>
    <dd>
    暂停下载


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">downloadId</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "DownloadManager:eraseDownload"></a>
    <strong>DownloadManager:eraseDownload (downloadId)</strong>
    </dt>
    <dd>
    移除下载


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">downloadId</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "DownloadManager:getDownloadUrl"></a>
    <strong>DownloadManager:getDownloadUrl (downloadId)</strong>
    </dt>
    <dd>
    获取下载的url


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">downloadId</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        url
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:getDownloadHeader"></a>
    <strong>DownloadManager:getDownloadHeader (downloadId)</strong>
    </dt>
    <dd>
    获取下载的头信息


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">downloadId</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        header
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:getFilePath"></a>
    <strong>DownloadManager:getFilePath (downloadId)</strong>
    </dt>
    <dd>
    获取下载的文件路径


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">downloadId</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        path
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:getTotalFileSize"></a>
    <strong>DownloadManager:getTotalFileSize (downloadId)</strong>
    </dt>
    <dd>
    获取下载的文件总大小


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">downloadId</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">int</span></span>
        size
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:getLocalFileSize"></a>
    <strong>DownloadManager:getLocalFileSize (downloadId)</strong>
    </dt>
    <dd>
    获取已下载的文件大小


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">downloadId</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">int</span></span>
        size
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:getStartTime"></a>
    <strong>DownloadManager:getStartTime (downloadId)</strong>
    </dt>
    <dd>
    获取已下载的文件开始时间


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">downloadId</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
        time
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:isFinished"></a>
    <strong>DownloadManager:isFinished (downloadId)</strong>
    </dt>
    <dd>
    获取是否已下载完成


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">downloadId</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">bool</span></span>
        finished
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:isDownloading"></a>
    <strong>DownloadManager:isDownloading (downloadId)</strong>
    </dt>
    <dd>
    获取是否正在下载


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">downloadId</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">bool</span></span>
        downloading
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:clearOnSuccessDownloadAllRecord"></a>
    <strong>DownloadManager:clearOnSuccessDownloadAllRecord ()</strong>
    </dt>
    <dd>
    清空完成记录







</dd>
    <dt>
    <a name = "DownloadManager:clearOnSuccessDownloadRecord"></a>
    <strong>DownloadManager:clearOnSuccessDownloadRecord (downloadId)</strong>
    </dt>
    <dd>
    清空单个完成记录


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">downloadId</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "DownloadManager:getDownloadIdsFromTextTag"></a>
    <strong>DownloadManager:getDownloadIdsFromTextTag (tag)</strong>
    </dt>
    <dd>
    根据标签获取下载id


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">tag</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
        ids
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:getDownloadAllTextTags"></a>
    <strong>DownloadManager:getDownloadAllTextTags ()</strong>
    </dt>
    <dd>
    获取下载的文件标签



    <h3>Returns:</h3>
    <ol>

           <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
        tags
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:getDownloadMaxCount"></a>
    <strong>DownloadManager:getDownloadMaxCount ()</strong>
    </dt>
    <dd>
    获取同时下载的文件最大数



    <h3>Returns:</h3>
    <ol>

           <span class="types"><span class="type">int</span></span>
        count
    </ol>




</dd>
    <dt>
    <a name = "DownloadManager:setDownloadMaxCount"></a>
    <strong>DownloadManager:setDownloadMaxCount (count)</strong>
    </dt>
    <dd>
    设置同时下载的文件最大数


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">count</span>
            <span class="types"><span class="type">int</span></span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "DownloadManager:setDownloadManagerDelegate"></a>
    <strong>DownloadManager:setDownloadManagerDelegate (callbacks)</strong>
    </dt>
    <dd>
    设置下载进度处理


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">callbacks</span>
            <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
        callbacks 包含onError,onProgress,onPauseDownload,onResumeDownload,onSuccess
        </li>
    </ul>




    <h3>Usage:</h3>
    <ul>
        <pre class="example">ca.sharedDownloadManager():setDownloadManagerDelegate{
	onError=<span class="keyword">function</span>(self,downloadid,errorCode)

	<span class="keyword">end</span>,
	onProgress=<span class="keyword">function</span>(self,downloadid,percent,nowDownloaded,totalToDownloaded)

	<span class="keyword">end</span>,
	onPauseDownload = <span class="keyword">function</span>(self,downloadid)

	<span class="keyword">end</span>,
	onResumeDownload = <span class="keyword">function</span>(self,downloadid)

	<span class="keyword">end</span>,
	onSuccess = <span class="keyword">function</span>(self,downloadid)

	<span class="keyword">end</span>,
}</pre>
    </ul>

</dd>
</dl>


</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2017-04-25 21:28:27 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>
